package com.edu.controller;

import com.edu.bean.Book;
import com.edu.bean.Car;
import com.edu.bean.User;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;

/**
 * @Author:何包蛋
 * @Date :2022/11/17 - 11 - 17 - 15:04
 */
@Controller
public class BookController {

    @RequestMapping("/book/{bookId}")
    public String regiest(@PathVariable("bookId") int bookId, Model model){
        System.out.println("查询了id:"+bookId+"的书");
        Book book = null;
        if(bookId == 1){
            book = new Book(1,"三体","科幻");
        }else if(bookId == 2){
            book = new Book(2,"流浪地球","科幻");
        }
        model.addAttribute("book" ,book);
        return "/success.jsp";
    }


}
